<?php
include_once '../AtacCommunicator/ACBusWaitingTimes.php';
include_once '../Exceptions/CommunicationException.php';
include_once '../InfoManager/InfoManager.php';
include_once '../Model/BusStop.php';
include_once '../Model/Location.php';
include_once '../Model/Address.php';
include_once '../Model/GPS.php';
include_once '../Utility/DebugLogs.php';



//$_GET["stopID"] = '74635';

if (isset($_GET["stopID"]))
{
	try {
		$stop = new BusStop(null, RMobUtils::escape_var($_GET["stopID"]));
		if(isset($_GET["fbID"]) && isset($_GET["access_token"])){
			$fbh = new FacebookHandler(RMobUtils::escape_var($_GET["access_token"]));
			if($fbh == null) echo "SHIT\n\n";
			$bsh = new BusSocialFeatures(null);
			$bsh->setFacebookHandler($fbh);
			echo $stop->toXMLSocial(EXTENDED_MODE,$bsh);
		}
		//BusStop(name, atacID)
			
		//extended mode
		else echo $stop->toXML(EXTENDED_MODE);
			
	}
	catch (Exception $e) {
		echo $e->toXML(EXTENDED_MODE);
	}
}

?>